package io.github.wppli.infrastructure.persistent.dao;

import io.github.wppli.infrastructure.persistent.po.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 用户表 Mapper 接口
 * </p>
 *
 * @author lijiaqiang@ljq1024.cc
 * @since 2024-12-23
 */
@Mapper
public interface IUserDao extends BaseMapper<User> {

    int insertOneWithEmail(User user);

    int insertOneWithPhoneNumber(User user);


    User queryOneWithEmail(@Param("email") String email);

    User queryOneWithPhoneNumber(@Param("phoneNumber") String phoneNumber);

    void setUserPasswordWithEmail(@Param("email")String email, @Param("encodedPassword")String encodedPassword);

    void setUserPasswordWithPhoneNumber(@Param("phoneNumber")String phoneNumber, @Param("encodedPassword")String encodedPassword);

    void bindEmailWithUsername(@Param("email")String email, @Param("username")String username);

    User queryUserInfoById(@Param("userId")String userId);

    User queryUserInfoByUsername(@Param("username")String username);

    void increaseFollowCount(@Param("userId")Long userId);

    void increaseFollowerCount(@Param("targetId")Long targetId);

    void decreaseFollowCount(@Param("userId")Long userId);

    void decreaseFollowerCount(@Param("targetId")Long targetId);
}
